Enhancing Movie Playback Performance
There are circumstances in which an application needs to optimize the performance of a movie or a portion of a movie. The Movie Toolbox provides several functions to help in this process.The first step you can take to enhance movie playback performance is to allow the Movie Toolbox to preroll the movie. When the toolbox prerolls a movie, it informs the media handlers that the movie is about to play. The media handlers can then load the appropriate movie data. In this manner, the movie can play smoothly from the start. Use the
PrerollMovie
function to preroll a movie.The next performance enhancement technique is to load portions of a movie, track, or media into memory, thus reducing or eliminating disk access during playback. Loading the movie into RAM provides most noticeable performance improvements when there is a lot of random access involved in the playback process and the entire movie fits into available memory. Use the
LoadMovieIntoRam
,LoadTrackIntoRam
, andLoadMediaIntoRam
functions to copy all or part of a movie into memory.
You can influence the temporal accuracy, and therefore the speed, with which the Movie Toolbox tries to display a movie by calling either the
- Note
- The
LoadMovieIntoRam
,LoadTrackIntoRam
, andLoadMediaIntoRam
functions load tracks into memory in a time-slice order so that, if a function fails because it is out of memory, all tracks are left loaded to about the same point in time.![]()
SetMoviePlayHints
orSetMediaPlayHints
function.For each movie currently in use, the Movie Toolbox maintains an active movie segment. The active movie segment is the part of the movie that your application is interested in playing. By default, the active movie segment is set to be the entire movie. You may wish to change this to be some segment of the movie--for example, if you wish to play a user's selection repeatedly. By setting the active movie segment you guarantee that the Movie Toolbox uses no samples from outside of that range while playing the movie. Use the
SetMovieActiveSegment
andGetMovieActiveSegment
functions to work with the active segment.Some movies contain very few key frames and a great number of frame differences. These movies play back very well because they have a lower data rate. Unfortunately, this makes random access operations, such as scrubbing, on a movie difficult. In such movies, random access is difficult.
To improve random access performance of movies with few key frames and many frame differences, shadow sync samples may be added. Shadow sync samples are self-contained samples that are alternates for already existing frame difference samples. During certain random access operations, a shadow sync sample is used instead of a normal key frame, which may be very far away from the desired frame.
The Movie Toolbox provides two functions to let you create just such an association between a frame difference sample and a sync sample.
SetMediaShadowSync
establishes a shadow sync sample for a media. You can useGetMediaShadowSync
to find out if a particular frame difference sample has a shadow sync sample.
Subtopics
- PrerollMovie
- SetMovieActiveSegment
- GetMovieActiveSegment
- SetMoviePlayHints
- SetMediaPlayHints
- LoadMovieIntoRam
- LoadTrackIntoRam
- LoadMediaIntoRam
- SetMediaShadowSync
- GetMediaShadowSync